#ifndef WLC_DILITHIUM_H_
#define WLC_DILITHIUM_H_

#include <stddef.h>
#include <stdint.h>
#include "config.h"
#include "../wlc_config.h"



/*============================================================================*/
/* Constant definitions                                                       */
/*============================================================================*/

typedef enum pid_en_
{
	DILITHIUM_NIST2,
	DILITHIUM_NIST3,
	DILITHIUM_NIST5
} pid_st;

/*============================================================================*/
/* Macro definitions                                                          */
/*============================================================================*/

#define crypto_sign_keypair DILITHIUM_NAMESPACE(_keypair)
#define crypto_sign DILITHIUM_NAMESPACE(_sign)
#define crypto_sign_open DILITHIUM_NAMESPACE(_open)

#define DILITHIUM2_CRYPTO_PUBLICKEYBYTES 1312
#define DILITHIUM2_CRYPTO_SECRETKEYBYTES 2544
#define DILITHIUM2_CRYPTO_BYTES 2420

#define DILITHIUM3_CRYPTO_PUBLICKEYBYTES 1952
#define DILITHIUM3_CRYPTO_SECRETKEYBYTES 4016
#define DILITHIUM3_CRYPTO_BYTES 3293

#define DILITHIUM5_CRYPTO_PUBLICKEYBYTES 2592
#define DILITHIUM5_CRYPTO_SECRETKEYBYTES 4880
#define DILITHIUM5_CRYPTO_BYTES 4595

#define NTESTS 10000

/*============================================================================*/
/* Function definitions                                                        */
/*============================================================================*/

#ifdef __cplusplus
extern "C"
{ /* start of __cplusplus */
#endif

	int crypto_sign_keypair(uint8_t *pk, uint8_t *sk);

	int crypto_sign(uint8_t *sm, size_t *smlen,
					const uint8_t *m, size_t mlen,
					const uint8_t *sk);


	int crypto_sign_open(uint8_t *m, size_t *mlen,
						 const uint8_t *sm, size_t smlen,
						 const uint8_t *pk);

	/**
	 * init dilithium parameters
	*/
	int dilithium_init(int level);

	void test_dilithium(int level);
	
#if REE_OR_TEE == 0
	void bench_dilithium(int level);
#elif REE_OR_TEE == 1
    void bench_dilithium(uint32_t out[3], int level);
	void bench_rng(uint32_t out[3]);
#endif

#ifdef __cplusplus
} /* end of __cplusplus */
#endif

#endif /* WLC_DILITHIUM_H_ */